package com.aaa.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface F_NeiRongDao {
    @Select("<script>" +
            "select a.*,b.name yearname ,c.name tname from testcontent a LEFT JOIN year b on a.yearid=b.id  " +
            "LEFT JOIN testproject c on a.pid=c.id" +
            " where 1=1 <if test=\"year!=null and year!=''\"> and b.name= #{year}</if>  " +
            " <if test=\"tname!=null and tname!=0\"> and c.id= #{tname}</if>  " +
            " limit #{start},#{pageSize} </script>")
    List<Map> selectList(Map map);
    @Select("<script>select count(a.id) from testcontent a LEFT JOIN year b on a.yearid=b.id  " +
            "LEFT JOIN testproject c on a.pid=c.id " +
            " where 1=1 <if test=\"year!=null and year!=0\"> and b.name= #{year}</if>  " +
            " <if test=\"tname!=null and tname!=0\"> and c.id= #{tname}</if>  " +
            "  </script>")
    Integer getCount(Map map);
    @Select("select c.id tid,c.name tname from testproject c ")
    List<Map> getYear();
@Update("UPDATE testcontent set yearid=#{x},pid=#{testproject},content=#{content},score=#{score},cldetailed=#{cldetailed},clrequest=#{clrequest},standard=#{standard} where id=#{id}")
    int update(Map map);
@Insert("insert into testcontent(yearid,pid,content,score,cldetailed,clrequest,standard,url) values(#{x},#{testproject},#{content},#{score},#{cldetailed},#{clrequest},#{standard},'/dataquery/rightmain2')")
    int add(Map map);
@Delete("DELETE FROM testcontent where id=#{id}")
    int del(Integer id);
    @Select("select id tname from year where name=#{yearname}")
    int getid(Map map);
    @Select("select id yearid from testproject where name=#{tname}")
    String getname(Map map);

@Select("select content from testcontent where id=#{id}")
    String getConter(Integer id);
@Select("select id from test_data where title=#{x}")
    List<Map> getScore(String x);
}
